import java.util.Scanner;
import java.util.Arrays;
public class Test2 {
    public static void main6(String[] args) {
        int[] array = {1,2,3,4};
        int[] copy = new int[array.length];
        System.arraycopy(array,1,copy,0,array.length-1) ;
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(copy));
        System.out.println("============");
        copy [0] =199;
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(copy));
    }
    public static void main(String[] args) {
        int[] array = {1,2,3,4};
        int[] ret = Arrays.copyOfRange(array,1,3);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(ret));

    }

    public static void main7(String[] args) {
        int[] array = {1,2,3,4};
        int[] array2 = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            array2 [i] = array[i];
        }
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array2));
        System.out.println("============");
        array2 [0] =199;
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array2));
    }
    public static String myToString(int[] array){
        if(array == null){
            return "null";//返回字符串null
        }
        String ret = "[";//在打印之前加[
        for (int i = 0; i < array.length ; i++) {
           // ret += array[i]+",";//数字遍历完一个数字之后拼接一个,
            ret += array[i];
            if(i !=array.length -1){
                ret +=" , ";
            }
        }
        ret = ret +"]";//这里是在输出完之后拼接了一个]
        return ret;
    }
    public static void main5(String[] args) {
        int[] array = {1,2,3,4,5};
        System.out.println(myToString(array) );//通过toString将array以字符串的形式输出
        System.out.println(myToString(null) );
    }
    public static void main4(String[] args) {
        int[] array ={1,2,3,4,5,6,7,8};
        int[] ret = grow3(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(ret));
    }
    public static int[] grow3(int[] array){
        int[] tmpArray = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            tmpArray[i] = array[i]*2;
        }
        return tmpArray;
    }
    public static void main3(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8,9};
       grow2(array);//这里不设置变量来接收返回值，
        System.out.println(Arrays.toString(array));

    }
    public static void grow2(int[] array1) {//这里也可以设置成void类型的返回值，不进行返回
        for (int i = 0; i < array1.length; i++) {
            array1[i] = array1[i] * 2;
        }
    }

        public static void main2(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8,9};
        int[] ret = grow(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(ret));
    }
        public static int[] grow(int[] array1){
        for(int i = 0; i < array1.length; i++){
            array1[i] = array1[i]*2;
        }
        return array1;
    }
    public static int[] func1(){
        int[] tmpArr = {10,11,12};
        return tmpArr;
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            Data data = new Data(x, y);
            System.out.println(data.getX() + data.getY());
        }
    }

}

class Data {

    int x;
    int y;

    Data(int x, int y) {
        this.x = x;
        this.y = y;
    }

    int getX() {
        return x;
    }

    int getY() {
        return y;
    }


}
